﻿@{
    ViewBag.Title = "UserList";
    Layout = "~/Views/Shared/_Main.cshtml";
}
@section Head{
    <style>
        .txtright
        {
            text-align: right;
            padding-left: 50px;
        }
        .searchArea input
        {
            width: 200px;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            var id = $.getUrlParam("id");
            if (id) {
                var parent = window.dialogArguments; //获取父页面参数 
                $("#txt_GUID").val(id);
                $("#txt_WildCard").val(parent.retWDCData[id].WildCard);
                $("#txt_FileExt").val(parent.retWDCData[id].FileExt);
                var eo = parent.retWDCData[id].ExtractOrder;
                $("input[value=" + eo + "]").attr("checked", "checked");
            }
        });
        function save() {
            if ($.trim($("#txt_WildCard").val()) == "") {
                alert("通配符名称不能为空！");
                return;
            }
            if ($.trim($("#txt_FileExt").val()) == "") {
                alert("文件扩展名不能为空！");
                return;
            }
            var v = 0;
            var id = $.getUrlParam("id");
            if (!id)
                id = -1;
            var parent = window.dialogArguments; //获取父页面参数
            var rtvalue = jv.GetDivArray($(".searchArea"), 4);
            for (var j = 0; j < parent.retWDCData.length; j++) {
                if (parent.retWDCData[j]["WildCard"] == rtvalue["WildCard"] && parent.retWDCData[j]["FileExt"] == rtvalue["FileExt"] && j != id) {
                    v++;
                }
            }
            if (v > 0) {
                alert("添加失败，存在相同的通配符！");
                return;
            }
            returnParent(rtvalue);
        } 
    </script>
}
<div style="margin: 5px;">
    <table class="listTitle">
        <tr>
            <td width="15">
                <img src="/images/edit.png" />
            </td>
            <td width="220">
                添加通配符
            </td>
            <td align="right">
                <input type="button" value="保存" onclick="save();" class="button" />
            </td>
        </tr>
    </table>
    <table class="searchArea" width="100%">
        <tr>
            <td height="150" valign="top">
                <table>
                    <tr>
                        <td class="txtright">
                            <span class="red">*</span>通配符：
                        </td>
                        <td>
                            <input type="hidden" id="txt_GUID" />
                            <input type="text" id="txt_WildCard" />
                        </td>
                    </tr>
                    <tr>
                        <td class="txtright">
                            <span class="red">*</span>文件扩展名：
                        </td>
                        <td> 
                            <input type="text" id="txt_FileExt" /> (多个扩展名可用"|"分割)
                        </td>
                    </tr>
                    <tr>
                        <td class="txtright">
                            抽取顺序：
                        </td>
                        <td>
                            <input type="radio" style="width: 18px;" name="rad_ExtractOrder" value="1" checked="checked" />时间
                            <input type="radio" style="width: 18px;" name="rad_ExtractOrder" value="2" />名称
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
